<?php

namespace app\admin\model;

use app\common\library\Model;


class Module extends Model
{
    // 表名
    protected $name = 'module';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    protected $readonly = ['identifier'];

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    
    // 追加属性
    protected $append = [
        'author_text'
    ];

    protected $type = [
        'config'       => 'json',
        'dependencies' => 'json',
    ];

    public function getAuthorTextAttr($value, $data, $v)
    {
        return '1234';
    }

    public function getConfigAttr($value) {
        return $value ? json_decode($value, true) : array();
    }
}